package com.xiaobaibai.security.common;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import java.util.UUID;

@Component
public class TokenCommon implements ApplicationRunner {

//    @Autowired
//    private StringRedisTemplate stringRedisTemplate;

    public static String TokenAssert=null;

//    public static final String RedisToken="RedisToken";

    public static final String TokenName ="TokenName";

    public static final String TokenRole="TokenRule";

    public static final String TokenResult="TokenResult";

    public static final String TokenVerify="TokenVerify";

    @Override
    public void run(ApplicationArguments args) throws Exception {
        this.switchSalt();
    }

    public String switchSalt(){
        System.out.println("换盐");
        String uuid= UUID.randomUUID().toString();
        TokenAssert=uuid;
        //不需要借助redis
//        stringRedisTemplate.opsForValue().set(RedisToken,uuid);
        return uuid;
    }

}
